<?php

namespace App\Library;

use Applet\Assemble\Byte;
use Exception;

class ByteLib extends Byte
{
    /**
     * @throws Exception
     */
    public static function init($config = []): void
    {
        parent::init(config('byte.byte'));
    }

    /**
     * @throws Exception
     */
    public function findRefundOrder(string $refundId)
    {
        $order = [
            'out_order_no' => $refundId,
            'app_id' => config('byte.byte.app_id'),
        ];
        $order['sign'] = parent::sign($order);
        return json_decode($this->curl_post($this->query, json_encode($order)), true);
    }
}
